package com.net.xpay.stat.task;

import com.net.xpay.common.domain.DailyTaskRecord;
import com.net.xpay.common.enums.systemTask.DailyTaskName;
import com.net.xpay.common.service.DailyTaskService;
import com.net.xpay.common.service.PartnerDailyStatService;
import com.net.xpay.common.service.impl.AbstractDailyTaskService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 合伙人用户日统计
 */
@Service
@Slf4j
public class PartnerDailyStatDailyTask extends AbstractDailyTaskService implements DailyTaskService {

    @Autowired
    private PartnerDailyStatService partnerDailyStatService;

    @Override
    protected String getDailyTaskName() {
        return DailyTaskName.PARTNER_DAILY_STAT;
    }

    @Override
    protected boolean doWorkByDayInternal(DailyTaskRecord record) {
        log.warn("start partnerUserDayStatDailyTask|day={}", record.getDay());
        partnerDailyStatService.statPartnerDaily(record.getDay(), record);
        log.warn("end partnerUserDayStatDailyTask|day={}", record.getDay());
        return true;
    }

    @Override
    protected int getFirstStartDayDiff() {
        return 7;
    }
}
